import * as THREE from 'three';
import {repeatWrapping} from '@/utils/repeatWrapping';
import albedo from '@/texture/box/albedo.png'
import nomals from '@/texture/box/normal.png'
import aos from '@/texture/box/ao.png'
import roughnesses from '@/texture/box/roughness.png'
import heightLights from '@/texture/box/height.png'


const map = new THREE.TextureLoader().load(albedo);//颜色材质贴图
const nomal = new THREE.TextureLoader().load(nomals);//法线材质贴图
const ao = new THREE.TextureLoader().load(aos);//环境遮挡贴图
const roughness = new THREE.TextureLoader().load(roughnesses);//材质的粗糙度贴图
const light = new THREE.TextureLoader().load(heightLights);//高光贴图


repeatWrapping(map,2,2);//重复平铺颜色贴图
repeatWrapping(nomal,2,2);//重复平铺法线贴图
repeatWrapping(ao,2,2);//重复平铺透明度贴图
repeatWrapping(roughness,2,2);//重复平铺粗糙度贴图
repeatWrapping(light,2,2);//重复平铺高光贴图


const material = new THREE.MeshStandardMaterial( 
    { 
        color: 0xffffff
        
    }
);

material.map = map
material.normalMap = nomal
material.aoMap = ao
material.roughnessMap = roughness
material.lightMap = light
material.emissive = 0x000000
material.roughness = 1
material.metalness = 0.3


export default material